public class Compteur2 implements Runnable{
private String nom = null;
public Compteur2(String n) {
nom=n;
}
public void run () {
for (int i=0; i<10; i++) {
System.out.println(nom + ": "+i);
try {Thread.sleep((long) Math.random()*5000);}
catch(InterruptedException e) { }
}
System.out.println(nom + " beeindigd op te tellen tot 10.");
// translation: finished to count until 10.
}
}